/**
 * 日期格式化
 * @author webopenfather
 * @param {String} param 日期字符串
 * @returns String
 */
function dateFormat(param) 
{
    if (param === undefined) {
        return;
    }
    let date = new Date(param);
    
    let now = new Date();
    let digit = parseInt((now.getTime() - date.getTime()) / 1000);
    
    let suffix = '秒前';

    if (digit < 60) {
        return '刚刚';
    } else {
        digit = parseInt(digit / 60);
        // console.log(digit);
        suffix = '分钟前';
        console.log(digit+suffix);
        if (digit >= 60) {
            digit = parseInt(digit / 60);
            suffix = '小时前';
            console.log(digit+suffix);
            if (digit >= 24) {
                digit = parseInt(digit / 24);
                suffix = '天前';
                console.log(digit+suffix);
                if (digit >= 30) {
                digit = parseInt(digit / 30);
                suffix = '个月前';
                console.log(digit+suffix);
                    if (digit >= 12) {
                        digit = parseInt(digit / 12);
                        suffix = '年前';
                        console.log(digit+suffix);
                    }
                }
            }
        }
    }
    return digit + suffix;
}  
